package com.itheima.bos.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.itheima.bos.domain.Standard;

public interface StandardRepository extends JpaRepository<Standard, Integer>{
	//第一种方法,只能用于给定的单词查找
//	public List<Standard> findByName(String name);
	//第二种方法用得比较多
	@Query(value="from Standard where name=?2 and id=?1",nativeQuery=false)
	public List<Standard> queryEE(Integer id,String name);
	
	//第二种方法的提升，query加上modifying来实现修改
	@Query(value="update Standard set name=?2 where id=?1")
	@Modifying
	public void updateStan(Integer id,String name);
}
